<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/plantilla1.xhtml">

    <ui:define name="contenido">

        <f:metadata>
            <f:event type="preRenderView" listener="#{loginBean.verificarErroresLogin()}" />
        </f:metadata>

        <h:form prependId="false">
            <h3>Iniciar Sesión</h3>
            
            <p>rut : password (perfil)</p>
            <ul>
                <li>11.111.111-1 : cambiame (super administrador)</li>
                <li>22.222.222-2 : cambiame (administrador)</li>
                <li>33.333.333-3 : cambiame (usuario)</li>
            </ul>
            
            <table>
                <tr>
                    <th>RUT: </th>
                    <td>
                        <p:inputText id="j_username" value="#{loginBean.rut}" required="true" style="width:200px;"
                                     styleClass="validaRut" maxlength="12">
                            <f:converter converterId="rutConverter"/>
                            <p:ajax process="@this" update="@this msjUsername" event="blur" global="false"/> 
                        </p:inputText>
                        <p:message id="msjUsername" for="j_username" display="text" />
                    </td>
                </tr>
                <tr>
                    <th>Contraseña: </th>
                    <td>
                        <p:password id="j_password" value="#{loginBean.password}" required="true" style="width:200px;" />
                        <p:message id="msjPassword" for="j_password" display="text" />
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <p:commandButton id="iniciar" action="#{loginBean.login()}" 
                                         value="Iniciar Sesión" 
                                         ajax="false" />   
                    </td>
                </tr>
            </table>
        </h:form>

    </ui:define>
</ui:composition>